package cn.sourcespro.spring.crudparams.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.http.HttpStatus;

/**
 * security
 *
 * @author zhanghaowei
 * @date 2018/7/14
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Vo {

    /**
     * code
     */
    private Integer code = 200;

    /**
     * msg
     */
    private String msg = "success";

    /**
     * data
     */
    private Object data;

    public Vo() {
    }

    public Vo(String msg) {
        this.msg = msg;
    }

    public Vo(Object data) {
        this.data = data;
    }

    public Vo(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Vo(Integer code, Object data) {
        this.code = code;
        this.data = data;
    }

    public Vo(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Vo(String msg, HttpStatus status) {
        this.code = status.value();
        this.msg = msg;
    }

    public Vo(Object data, String msg, HttpStatus status) {
        this.code = status.value();
        this.msg = msg;
        this.data = data;
    }

    public Vo(Object data, HttpStatus status) {
        this.code = status.value();
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
